class NetworkModifier(object):
    def __init__(self):
        '''
        Constructor
        '''
        
        self.useDynamicFields = False
        
    def SetNetworkField(self, network, field, value):
        self._SetPotentiallyDynamicField(network, field, value)
    
    def SetAgentField(self, agent, field, value):
        self._SetPotentiallyDynamicField(agent, field, value)
        
    def _SetPotentiallyDynamicField(self, objToModify, field, value):
        objToModify.__dict__[field] = value
        if self.useDynamicFields == True:
            objToModify.__dict__[field + "_" + self.__class__.__name__] = value


    
    def SetNetworkDictEntry(self, network, dictName, key, value):
        self._SetPotentiallyDynamicDictEntry(network, dictName, key, value)

    def SetAgentDictEntry(self, agent, dictName, key, value):
        self._SetPotentiallyDynamicDictEntry(agent, dictName, key, value)
    
    def _SetPotentiallyDynamicDictEntry(self, objToModify, dictName, key, value):
        objToModify.__dict__[dictName][key] = value
        if self.useDynamicFields == True:
            dynamDictName = dictName + "_" + self.__class__.__name__
            if (dynamDictName in objToModify.__dict__.keys()) == False:
                objToModify.__dict__[dynamDictName] = {}
                
            objToModify.__dict__[dynamDictName][key] = value